package com.mathlearning.auth.repository;

import com.mathlearning.auth.entity.LearningCategory;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface LearningCategoryRepository extends JpaRepository<LearningCategory, Long> {
    List<LearningCategory> findAllByOrderBySortOrderAsc();

    @Query("select count(c) from LearningCourse c where c.categoryId = ?1 and c.status = 'published'")
    Long countPublishedCourses(Long categoryId);
}




